public class ZhaiZhiJie02
{
    public static void main(String[] args) {
        rectangle rec = new rectangle(10.0, 20.0);
        System.out.println(rec.area());
        System.out.println(rec.perimeter());
    }
}

abstract class Shape
{
    public abstract double area();
    public abstract double perimeter();
}

class rectangle extends Shape
{
    private double a;
    private double b;
    public rectangle(double a, double b)
    {
        this.a = a;
        this.b = b;
    }
    public double area()
    {
        return 2*(a + b);
    }
    public double perimeter()
    {
        return a * b;
    }
}
